package br.senac.notafiscal.managedbean;

import java.io.Serializable;
import java.util.List;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

import br.senac.notafiscal.entity.Cliente;
import br.senac.notafiscal.service.ClienteService;

@ManagedBean
@SessionScoped
public class ClienteMB implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private Cliente cliente;
	private ClienteService clienteService;

	public Cliente getCliente() {
		return cliente;
	}

	public void setCliente(Cliente cliente) {
		this.cliente = cliente;
	}

	public ClienteMB() {
		clienteService = new ClienteService();
	}

	public void excluir() {
		clienteService.excluirCliente(cliente);
	}
	
	public List<Cliente> getListaClientes() {
		return clienteService.listarClientes();
	}

	public void novo() {
		cliente = new Cliente();
	}

	public void salvar() {
		clienteService.salvarCliente(cliente);

	}
}
